package com.liuym.admin.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.liuym.admin.repository.model.entity.TableNameEntity;
import com.liuym.admin.service.TableNameService;
import com.liuym.common.dubbo.table.api.TableNameDubboService;
import com.liuym.common.dubbo.table.dto.TableNameDTO;
import com.vip.vjtools.vjkit.mapper.BeanMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Liuym
 * @date 2019/1/22 14:33
 * @describe：
 */
@Service(version = "${admin.dubbo.version}")
public class TableNameDubboServiceImpl implements TableNameDubboService {

    @Autowired
    private TableNameService tableNameService;

    @Override
    public TableNameDTO findByTableAndTime(String tableName) {
        TableNameEntity table = tableNameService.findByTableAndTime(tableName);
        if (table != null) {
            return BeanMapper.map(table, TableNameDTO.class);
        }
        return null;
    }
}
